package com.huaqin.punan.animationdemo;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class SecondActivity extends Activity implements OnClickListener{
	
	private Button btnGo;
	private Button btnBack;
	private TextView tv;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		tv = (TextView)findViewById(R.id.tv);
		tv.setText("Activity Two");
		tv.setTextSize(25);
		
		btnGo = (Button)findViewById(R.id.btn_go);
		btnGo.setOnClickListener(this);
		
		btnBack = (Button)findViewById(R.id.btn_back);
		btnBack.setOnClickListener(this);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch(v.getId()){
		case R.id.btn_go:
			Intent intent = new Intent();
			intent.setClass(SecondActivity.this,ThirdActivity.class);
			SecondActivity.this.startActivity(intent);
			//overridePendingTransition(android.R.anim.fade_in,android.R.anim.fade_out);
			overridePendingTransition(android.R.anim.slide_in_left,android.R.anim.slide_out_right);
			break;
		case R.id.btn_back:
			Intent intent_back = new Intent();
			intent_back.setClass(SecondActivity.this,MainActivity.class);
			SecondActivity.this.startActivity(intent_back);
			//overridePendingTransition(android.R.anim.fade_in,android.R.anim.fade_out);
			overridePendingTransition(android.R.anim.slide_in_left,android.R.anim.slide_out_right);
			break;
		}
	}

}
